import send_msg from '@feidao-factory/send-msg';
import { ICondition } from '../../interfaces';

export default function python(action_id: string, session_id: string, spaceid: string, modelid: string, condition: ICondition, systemid?: string, refsystemid?: string) {
	if (!condition) {
		condition = {
			paging: {
				index: 1,
				size: 12
			},
			param: {},
			sort: {}
		} as any;
	}
	if (!condition.paging) {
		condition.paging = {
			index: 1,
			size: 12
		};
	}
	if (!condition.param) {
		condition.param = {} as any;
	}
	if (!condition.sort) {
		condition.sort = {};
	}
	const msg = {
		condition,
		modelid: 'custom::py_' + modelid,
		refsystemid,
		spaceid,
		systemid
	};
	return send_msg(action_id, session_id, 'dataservice.py', msg);
}
